<?php $this->_extends('../_layouts/default_layout')?>
<?php $this->_block('contents')?>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/jq.mselect.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.multiselect.js"></script>
<script type="text/javascript">
$(function(){
	$(".datepicker").datepicker({dateFormat: 'yy-mm-dd', changeMonth: true});
	$("#shop_ids").multiselect({height: 260, minWidth: 160});
	$(".note_icon").colorbox();
});
</script>
<fieldset><legend>查询条件</legend>
<form method="get">
<?include (Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
<table class="form_table">
<tr>
	<th>回复时间</th>
	<td>
		<input type="text" name="begin_send_time" class="datepicker" value="<?=isset($_GET['begin_send_time']) ? $_GET['begin_send_time'] : ''?>" /> To
		<input type="text" name="end_send_time" class="datepicker" value="<?=isset($_GET['end_send_time']) ? $_GET['end_send_time'] : ''?>" />
	</td>
</tr>
<tr>
	<th>买家ID</th>
	<td><input type="text" name="recipient" value="<?=isset($_GET['recipient']) ? $_GET['recipient'] : ''?>" /></td>
</tr>
<tr>
	<th>店铺</th>
	<td>
		<select name="shop_ids[]" multiple="multiple" id="shop_ids">
			<optgroup label="ebay">
				<?foreach ($shop as $s):?>
				<option value="<?=$s['id']?>" <?if (isset($_GET['shop_ids']) && in_array($s['id'], $_GET['shop_ids'])):?>selected="selected"<?endif;?>><?=$s['name']?></option>
				<?endforeach;?>
			</optgroup>
		</select>
	</td>
</tr>
<tr>
	<th>发送类型</th>
	<td>
		<label><input type="checkbox" name="send_type[]" value="contact" <?=isset($_GET['send_type']) && in_array('contact', $_GET['send_type']) ? 'checked="checked"' : ''?> />主动联系</label>
		<label><input type="checkbox" name="send_type[]" value="response" <?=isset($_GET['send_type']) && in_array('response', $_GET['send_type']) ? 'checked="checked"' : ''?> />邮件回复</label>
	</td>
</tr>
<tr>
	<th>发送状态</th>
	<td>
	<?foreach (Q::ini('custom_flag/services_ebay_message_send_send_flag') as $sf):?>
		<label><input type="checkbox" name="send_flag[<?=$sf['value']?>]" value="<?=$sf['value']?>" <?=isset($_GET['send_flag']) && in_array($sf['value'], $_GET['send_flag']) ? 'checked=checked' : ''?> /> <?=$sf['name']?></label> 
	<?endforeach;?>
	</td>
</tr>
<tr>
	<td colspan="2"><input type="submit" class="button" value="查询" /></td>
</tr>
</table>
</form>
</fieldset>
<table class="list_table" width="100%">
<tr>
	<th>邮件主题</th>
	<td width="25">正文</td>
	<td>ItemID</td>
	<th>发送账号</th>
	<th>接收账号</th>
	<th width="140">发送时间</th>
	<th width="100">操作人</th>
</tr>
<?foreach ($send as $s):?>
<tr>
	<td align="left">
		<span class="send_<?=Helper_BSS_Normal::getIniOne('services_ebay_message_send_send_flag', 'value', $s['send_flag'], 'text')?>_icon" title="发送<?=Helper_BSS_Normal::getIniOne('services_ebay_message_send_send_flag', 'value', $s['send_flag'], 'name')?>"></span>
		<?if ($s['services_ebay_message_id']):?>
		<a href="<?=url('Services::EbayMessage/Detail', array('id' => $s['services_ebay_message_id']))?>" target="_blank"><?=$s['subject']?></a>
		<?endif;?>
	</td>
	<td><a class="note_icon" href="<?=url('Services::EbayMessage/SendDetail', array('id' => $s['id']))?>"></a></td>
	<td><?=$s['shop_item_id']?></td>
	<td><?=$s['sender']?></td>
	<td><?=$s['recipient']?></td>
	<td><?=$s['send_time']?></td>
	<td><?=$s['send_user_name']?></td>
</tr>
<?endforeach;?>
</table>
<?=$page;?>
<?php $this->_endblock()?>